Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Androapp 5497 mobile UI implement image block #81

Merged
merged 5 commits into from
Oct 10, 2023

Conversation

siddh1004
Copy link
Collaborator

No description provided.

@Composable
fun ImageBlockScreen() {
ImageBlock(
file = File("/data/data/org.hisp.dhis.android/files/sample.jpg"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can add a sample image jpg in the commons module and then use it here to test the component

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using a packaged resource. We can add an option to pick a file from the device storage in the catalog app? Since that's will be actual use case no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but this would made us handling permissions right?. I mean mean while is in commons and not in desigsystem module both solutions will look good for me

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we would be handling packaged resource and this block expects a file path. I don't think that would work, no? The other approach we were discussing is to create a Painter and we can pass any painter like painterResource or painterFile (we create the painter file).

With that we can pass painterResource in catalog app and use painterFile in production if that works.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andresmr @msasikanth I have update the Image Block to make it more generic, now we can pass the type of resource we want to load such as ImageBitmap, Painter, etc. And painter parameter to define how to paint it.
For Loading Image from Local Storage
ImageBlock( load = { loadImageBitmap() }, painterFor = { remember { BitmapPainter(it!!) } }, onClick = {}, )

For Loading Image from Resource
ImageBlock( load = { painterResource("drawable/sample.png") }, painterFor = { remember { it } }, onClick = {}, )

@siddh1004 siddh1004 force-pushed the ANDROAPP-5497-mobile-ui-Implement-Image-Block branch from 8e30520 to c18ff6f Compare October 4, 2023 11:39
@siddh1004 siddh1004 force-pushed the ANDROAPP-5497-mobile-ui-Implement-Image-Block branch 2 times, most recently from 8c295d7 to 838df9a Compare October 5, 2023 12:26
@siddh1004 siddh1004 force-pushed the ANDROAPP-5497-mobile-ui-Implement-Image-Block branch from 838df9a to 88ad368 Compare October 6, 2023 11:45
@xavimolloy xavimolloy force-pushed the ANDROAPP-5497-mobile-ui-Implement-Image-Block branch from 88ad368 to 748ac45 Compare October 10, 2023 10:59
@xavimolloy xavimolloy merged commit f61e587 into main Oct 10, 2023
2 checks passed
@xavimolloy xavimolloy deleted the ANDROAPP-5497-mobile-ui-Implement-Image-Block branch October 10, 2023 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants